package com.zhangjh.dto;

import java.util.Date;

import javax.validation.constraints.Past;

import org.hibernate.validator.constraints.NotBlank;

import com.fasterxml.jackson.annotation.JsonView;
import com.zhangjh.validator.MyConstraint;

public class User {
	
	public interface UserSimpleView {};
	
	public interface UserDetailView extends UserSimpleView {};
	
	private Integer id;
	
	@MyConstraint(message = "这是个测试")
	private String userName;
	
	@NotBlank(message = "密码不能为空！")
	private String password;
	
	@Past(message = "生日不能为未来日期！")
	private Date brithday;
	@JsonView(UserSimpleView.class)
	public String getUserName() {
		return userName;
	}
	
	@JsonView(UserDetailView.class)
	public Integer getId() {
		return id;
	}
	
	public void setId(Integer id) {
		this.id = id;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}
	
	@JsonView(UserDetailView.class)
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
	@JsonView(UserSimpleView.class)
	public Date getBrithday() {
		return brithday;
	}

	public void setBrithday(Date brithday) {
		this.brithday = brithday;
	}

	@Override
	public String toString() {
		return "User [id=" + id + ", userName=" + userName + ", password=" + password + ", brithday=" + brithday + "]";
	}
	
	
}
